/* 
    file:   ui_numinput.c
    code:   c  (utf-8)
 */
/* -------------------------------------------------------------------------- */
#include "ui_numinput.h"

/* -------------------------------------------------------------------------- */

/* 输入驱动 */
uint8_t dev_touch_cb (point *ppnt)
{
    touch_pos_t touch_temp;
    if(!HAL_GPIO_ReadPin(T_PEN_GPIO_Port, T_PEN_Pin))
    {
        touch_temp = get_touch_pos();

        ppnt->x = touch_temp.x;
        ppnt->y = touch_temp.y;
        return 1;
    }
    else
    {
        ppnt->x = 0;
        ppnt->y = 0;
        get_touch_pos();
        return 0;
    }
}
struct ui_input devinput=
{
    .lastpoint = {0},
    .laststatus = 0,
    .pgt_cb = dev_touch_cb,
};
/* -------------------------------------------------------------------------- */
#include "netconnect.h"
/* 屏幕信息 */
uint16_t screenb_buf[LCD_WIDTH][LCD_HEIGHT] UD_RAM_ATTRIBUTES;
uint16_t screena_buf[LCD_WIDTH][LCD_HEIGHT] UD_RAM_ATTRIBUTES;
void scr_print_cb(uint16_t sx,uint16_t sy,uint16_t ex,uint16_t ey,uint16_t *color)
{
    //LTDC_Color_Fill(ltdc_lcd_framebuf,sx,sy,ex,ey,color);
    //LTDC_Img_CopyToDram(sx,sy,ex,ey,color);
    sendoneimg(sx,sy,ex,ey,color);
}
struct ui_screen scrinfo=
{
    .width = LCD_WIDTH,
    .heigh = LCD_HEIGHT,
    .pbfb = screenb_buf,
    .pbfa = screena_buf,
    .printer = scr_print_cb,
};
/* -------------------------------------------------------------------------- */

/* ui信息 */
struct ui_core inputui=
{
    .pscr = &scrinfo,
    .pindev = &devinput,
    .status = 0,
};
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

uint8_t ui_getnums(UI_NUMINPUT_T * pnumio,uint8_t *strtitle,condev_t * pdev)
{
    struct ui_obj * imgback = null;
    imgback = ui_newimage(0);

    ui_imgage_set_img(imgback,&appimglist.imglist[IMGIDX_INPUTBK]);

    while ()
    {

    }

    ui_delobj(imgback);
    imgback = NULL;
}
